import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: AnimatePaddingPage());
  }
}

class AnimatePaddingPage extends StatefulWidget {
  @override
  _AnimatePaddingPageState createState() => _AnimatePaddingPageState();
}

class _AnimatePaddingPageState extends State<AnimatePaddingPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('动画示例')),
      body: SizedBox.expand(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              color: Colors.red,
              child: AnimatedPadding(
                duration: Duration(seconds: 1),
                curve: Curves.bounceIn,
                padding: EdgeInsetsGeometry.only(left: 10, right: 10),
                child: Text("早起的年轻人"),
              ),
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          setState(() {
            dx += 10;
            dy += 10;
          });
        },
        child: Icon(Icons.change_circle),
      ),
    );
  }

  double dx = 10;
  double dy = 10;
}
